//
//  TravelsFirst_TravelsDetailsTableViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TravelsFirst_TravelsDetailsTableViewCell.h"


#define CellW  self.contentView.frame.size.width
#define CellH  self.contentView.frame.size.height


@interface TravelsFirst_TravelsDetailsTableViewCell ()

@property (nonatomic, strong) UIImageView *photoImageView;

@property (nonatomic, strong) UIImageView *videoImageView;

@property (nonatomic, strong) UILabel *wordLabel;


@end

@implementation TravelsFirst_TravelsDetailsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createSubviews];
        
    }

    return  self;
}

- (void)createSubviews{
    
    self.videoImageView = [[UIImageView alloc]init];
    self.videoImageView.backgroundColor = [UIColor magentaColor];
    [self.contentView addSubview:self.videoImageView];
    
    
    self.photoImageView = [[UIImageView alloc]init];
    self.photoImageView.backgroundColor = YTColor(236, 240, 245, 1.0);
    [self.contentView addSubview:self.photoImageView];
    
    
    self.wordLabel = [[UILabel alloc]init];
    self.wordLabel.backgroundColor = YTColor(236, 240, 245, 1.0);
    [self.contentView addSubview:self.wordLabel];
    
    
    
}


- (void)layoutSubviews{
    
    //video的高度
    CGFloat heightVideo = [height_FZFF getHeightImageWithHeight:self.tableCellModel.video_height withWidth:self.tableCellModel.video_width widthNowImage:CellW - 20];
    
    self.videoImageView.frame = CGRectMake(10, 10, CellW - 20, heightVideo);
    
    [self.videoImageView sd_setImageWithURL:[NSURL URLWithString:self.tableCellModel.photoUrl]];
    
    
    //photode 高度
    CGFloat heightImage = [height_FZFF getHeightImageWithHeight:self.tableCellModel.image_height withWidth:self.tableCellModel.image_width widthNowImage:CellW - 20];
    
    self.photoImageView.frame = CGRectMake(10, 10 + heightVideo, CellW - 20, heightImage);
    
    [self.photoImageView sd_setImageWithURL:[NSURL URLWithString:self.tableCellModel.photoUrl]];
    
    //lebel的高度
    
    CGFloat heightLabel = [height_FZFF getLabelHeightWithString:self.tableCellModel.descriptions widthNowLabel:CellW - 20 fontSize:17 options:NSStringDrawingUsesLineFragmentOrigin];
    
    self.wordLabel.frame = CGRectMake(10, 10 + heightVideo + heightImage, CellW - 20, heightLabel);
    self.wordLabel.text = self.tableCellModel.descriptions;
    self.wordLabel.numberOfLines = 0;
    
}



@end
